#ifndef __IUTILITY__
#define __IUTILITY__

#include "IObject.h"

enum SysVarType
{
	svMutex = 1,
	svSemaphore = 2,
	svEvent = 3,
	svTime = 4,
	svShrMem = 5
};

#define CREATE_STR_FUN(ptrStrFun)\
  ptrStrFun = Invoke<IStrFun>("CStrFun", nullptr, nullptr, 0);\

#define CREATE_SYS_FUN(ptrSysFun)\
  ptrSysFun = Invoke<ISysFun>("CSysFun", nullptr, nullptr, 0);\

typedef enum { emHours = 0, emMinutes = 1, emSeconds = 2,  emMilliseconds = 3, emMicroseconds = 4, emNanoseconds = 5 }CTimeingType;


class IStrFun : public virtual IObject
{
public:
	virtual const char * SeparateString(char * pszResult, int iSize, const char * pszStr, const char * pszSpeStr, const int iIdx) const = 0;
	virtual const char * BeforSeparateString(const char * pszStr, const char * pszSpeStr, const int iIdx) const = 0;
	virtual const int SeparateCount(const char * pszStr, const char * pszSpeStr) const = 0;
	virtual const int StrCount(const char * pszStr, const char * pszSpeStr) const = 0;
	virtual const int Pos(const char * pszStr, const int iLen, const char * ptrFind, const int iFindLen) = 0;
	virtual const int Pos(const char * pszStr, const char * pszSubStr) const = 0;
	virtual const bool IsEmpty(const char * pszStr) const = 0;
	virtual const char * ParaVal(char * pszResult, int iSize, const char * pszCommandTxt, const char * pszParaName) const = 0;
	virtual const char * KeyVal(char * pszValue, int iSize, const char * pszCommandTxt, const char * pszKeyName, const char * pszSpeStr = ";") const = 0;
	virtual const char * CaseUpper(const char *pszStr) const = 0;
	virtual const char * Trim(char * pszResult, int iSize, const char * pszStr) const = 0;
	virtual const bool IsNum(const char * pszStr) const = 0;
	virtual const bool GetIniFileSectionInfo(const char * pszIniFile, const char * pszSectionName, void * pvtSectionInfo) = 0;
    virtual const bool MemCopy(void * ptrDes, void * ptrSou, int iDesLen, int iSouLen, bool AFullCpyFlg = false) = 0;
	virtual const bool CurrToStr(string & strNum, string & strValue, int iDigits, int iCarryNum = 5) = 0;
	virtual const bool CurrToStr(double dNum, string & strValue, int iDigits, int iCarryNum = 5) = 0;
	virtual const bool CurrToStr(char * pszNum, char * pszValue, int iLen, int iDigits, int iCarryNum = 5) = 0;
	virtual const bool CurrToStr(double dNum, char * pszValue, int iLen, int iDigits, int iCarryNum = 5) = 0;
	virtual char * StrReplace(char * pszSouStr, char * pszDesStr, int iDesSize, const char * pszOld, const char * pszNew) = 0;
	virtual string StrReplace(string & strStr, const char * pszOld, const char * pszNew) = 0;
};

class ISysFun : public virtual IObject
{
public:	
	virtual const bool PathOrFileExists(const char * pszPath) = 0;
	virtual const char * ExtractFileName(const char * pszFileName, char * pszPath, const int iPathSize) = 0;
	virtual const char * ExtractFilePath(const char * pszFileName, char * pszPath, const int iPathSize) = 0;
	virtual const char * CurrentPath(char * pszPath) = 0;
	virtual const bool MkDir(const char *pszPath) = 0;
	virtual const char * GetLocalIP(char* p_pszIPAddr, int p_iSize) = 0;
	virtual char *GetGuid(char *pszGuid, int iSize) = 0;
	virtual const int CurrentDate() = 0;
	virtual const char * CurrentDate(char * pszResult, const int iLen) = 0;
	virtual const long long CurrentTime() = 0;
	virtual const char * CurrentTime(char * pszResult, const int iLen) = 0;
	virtual const long long SequenceNo() = 0;
	virtual const bool KillProcessById(unsigned long ulPid) = 0;
	virtual const bool KillProcessByName(const char * pszProcessName) = 0;
	virtual const bool ExistProcessId(unsigned long ulPid) = 0;
	virtual const unsigned long ExeFileNameByProcessID(const char * pszProcessName, void * ptrProcessID) = 0;
	virtual const char * ProcessID2FileName(unsigned long ulPid, char * pszResult, const int iLen) = 0;
	virtual long long GetTick(CTimeingType TimeingType = emMilliseconds) = 0;
    virtual void DelIcon(const char * pszFileName) = 0;
    virtual const unsigned long CurrentProcessId() = 0;
	virtual const int CompareValue(const double dNum1, const double dNum2) = 0;
	virtual ::HANDLE GetSysVar(const char * pszVarName, SysVarType emVarType) = 0;
	virtual void * CreateShrMem(HANDLE & refShrMemHnd, const char * pszShrMemName, const int iSize) = 0;
	virtual const bool FreeShrMem(HANDLE  & refShrMemHnd, void * ptrMapViewOfFile) = 0;
};

//class ILog : public virtual IObject
//{
//public:
//	virtual const void WriteLog(const char * pszLogTxt) const = 0;
//};



#endif//__IUTILITY__